package org.example.controller;

import org.example.dto.UserDto;
import org.example.result.ServerResponse;
import org.example.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 用户controller
 *
 * @author: User
 * @description:
 * @create: 2024-07-23 16:41
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService iUserService;
    /**
     * 用户列表
     *
     * @return org.example.result.ServerResponse
     * @author: user
     * @date: 2024-07-23 16:44:32
     */
    @PostMapping("/list")
    public ServerResponse list() {
        return ServerResponse.operateSuccess(
                iUserService.list());
    }

    /**
     * 添加用户
     *
     * @param userDto
     * @return org.example.result.ServerResponse
     * @author: user
     * @date: 2024-07-23 16:44:32
     */
    @PostMapping("/add")
    public ServerResponse add(UserDto userDto) {
        return ServerResponse.operateSuccess();
    }

    /**
     * 修改用户
     *
     * @param userDto
     * @return org.example.result.ServerResponse
     * @author: user
     * @date: 2024-07-23 16:44:32
     */
    @PostMapping("/update")
    public ServerResponse update(UserDto userDto) {
        return ServerResponse.operateSuccess();
    }

    /**
     * 删除用户
     *
     * @param userId
     * @return org.example.result.ServerResponse
     * @author: user
     * @date: 2024-07-23 16:44:32
     */
    @PostMapping("/del")
    public ServerResponse del(Integer userId) {
        return ServerResponse.operateSuccess();
    }

    /**
     * 获取单个用户
     *
     * @param userId
     * @return org.example.result.ServerResponse
     * @author: user
     * @date: 2024-07-23 16:45:53
     */
    @PostMapping("/getOne")
    public ServerResponse getOne(Integer userId) {
        return ServerResponse.operateSuccess(new UserDto());
    }
}
